import Vue from 'vue'
import VueRouter from 'vue-router'
import Demo from '../views/Demo'
import ErrorPage from '../views/404'
import BigDataPage from "../views/BigDataPage";
import ObjectExtraction from "../views/function-pages/ObjectExtraction.vue"
import ChangeDetection from "../views/function-pages/ChangeDetection.vue"
import ObjectDetection from "../views/function-pages/ObjectDetection.vue"
import TerrainClassification from "../views/function-pages/TerrainClassification.vue"
import Personal from '../views/personal-pages/Personal.vue'
import EditUserInfo from '../views/personal-pages/EditUserInfo.vue'
import PortfolioDetailsPage from '../views/PortfolioDetailsPage.vue'
; //6.12


Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        name: 'Demo',
        component: Demo,
        meta: {
            title: 'WCFun || Now you see me',
        },
    },
    {
        path: '/bigdata',
        name: 'bigdata',
        component: BigDataPage,
        meta: {
            title: '大数据||Bigdata'
        }
    },
    {
        path: '/objectExtraction',
        name: 'objectExtraction',
        component: ObjectExtraction,
        meta: {
            title: '目标提取 - ObjectExtraction'
        }
    },
    {
        path: '/changeDetection',
        name: 'changeDetection',
        component: ChangeDetection,
        meta: {
            title: '变化检测 - ChangeDetection'
        }
    },
    {
        path: '/objectDetection',
        name: 'objectDetection',
        component: ObjectDetection,
        meta: {
            title: '目标检测 - ObjectDetection'
        }
    },
    {
        path: '/terrainClassification',
        name: 'terrainClassification',
        component: TerrainClassification,
        meta: {
            title: '地物分类 - TerrainClassification'
        }
    },
	{
	    path: '/personal',
	    name: 'Personal',
	    component: Personal,
	    meta: {
	        title: '个人中心 - Personal'
	    }
	},
	{
	    path: '/editUserInfo',
	    name: 'EditUserInfo',
	    component: EditUserInfo,
	    meta: {
	        title: '编辑信息 - EditUserInfo'
	    }
	},
{
        path: '/portfolio-details/:id',
        name: 'Portfolio details',
        component: PortfolioDetailsPage,
        meta: {
            title: '图片详情 - Image Details',
        },
    },
    {
        path: '/error',
        name: 'Error',
        component: ErrorPage,
        meta: {
            title: '404',
        },
    }
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

router.beforeEach((to, from, next) => {
    document.title = to.meta.title;
    next();
    window.scrollTo(0, 0)
});

export default router
